package view;

import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.*;
import javax.swing.event.ChangeListener;

import ViewPropertyPanel.ViewPropertyToolBar;

import tabbedCanvas.LayeredCanvas;
import util.resources.ResourceManager;

/**
 * Creates center panel for the Viewer. Panel contains tabbed 
 * pane, info panel, and property panel. Utilizies resource file
 * so that properties can easily be changed. 
 *   
 * @author wesleybrown
 *
 */
public class InnerFrame extends JPanel {

	private static final long serialVersionUID = 1L;
	//private PropertyPanel leftPanel;
	private TabbedPanel centerPanel;
	private InfoPanel rightPanel;
	private ViewPropertyToolBar leftPanel;
	
	/**
	 * Creates center panel. 
	 * 
	 * @param resources ResourceManager linked to property file
	 * including settings for history, variable, tabbed, and property panes.
	 */
	public InnerFrame(ResourceManager resources, ChangeListener controller, ActionListener viewController) {
		BorderLayout b = new BorderLayout();
		this.setLayout(b);

//		leftPanel = new ColumnTextArea(
//				picassaMiddleFrameResource.getInteger("LeftPanelNumber"),
//				picassaMiddleFrameResource.getStringArray("LeftPanelLabels"));
		leftPanel = new ViewPropertyToolBar(viewController);
		centerPanel = new TabbedPanel(resources, controller);
		rightPanel = new InfoPanel(resources);

		//add(leftPanel, BorderLayout.WEST);
		this.add(centerPanel, BorderLayout.CENTER);
		this.add(rightPanel, BorderLayout.EAST);
		this.add(leftPanel, BorderLayout.WEST);
	}
	
	/**
	 * Gets the current list of panes containing drawn vectors
	 *  
	 * @return List<layeredPane> list of panes containing drawn vectors
	 */
	public List<LayeredCanvas> getCanvasList(){
		return centerPanel.getLayeredCanvas();
	}
	
	public void addHistory(String msg){
		rightPanel.addHistory(msg);
	}
	
	public void addVariable(String msg){
		rightPanel.addVariable(msg);
	}
	public void cleanAndUpdate(List<String> list) {
		rightPanel.cleanAndUpdate(list);

	}
	
}
